package com.example.login.service;
import com.example.login.mapper.DormMapper;
import com.example.login.entity.Dorm;
import com.example.login.entity.DormRoom;
import com.example.login.entity.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class DormServiceImp implements DormService {

    @Resource
    private DormMapper dd;

    @Override
    public int countDormsNum() {
        return dd.countDormsNum();
    }

    @Override
    public List<Dorm> findAll() {
        return dd.findAll();
    }

    @Override
    public List<DormRoom> findFreeBed() {
        return dd.findFreeBed();
    }

    @Override
    public List<Map<String, String>> countFreeRooms() {
        return dd.countFreeRooms();
    }

    public Result queryBeds(Map<String, String> queryInfo){
        Result result = new Result();
        //验证token是否正确
        //查询空床位
        List<Map<String, String>> querydata = countFreeRooms();
        result.setStatus(1);
        result.setMsg("查询所有空床位");
        result.setData(querydata);

        return result;
    }

}
